home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / Documents / JAVA Programming / examples / 12 / HTDemo.java < prev    next >
Encoding:
Java Source  |  2000-09-08  |  552 b   |  18 lines

  1. import java.util.Dictionary;
  2. import java.util.Hashtable;
  3. class HTDemo {
  4. public static void main(String args[]) { 
  5. Hashtable ht = new Hashtable();
  6. ht.put("title", "The Java Handbook");
  7. ht.put("author", "Patrick Naugnton");
  8. ht.put("email", "naughton@starwave.com");
  9. ht.put("age", new Integer(30));
  10. show(ht);
  11. }
  12. static void show(Dictionary d) {
  13. System.out.println("Title: " +    d.get("title"));
  14. System.out.println("Author: " + d.get("author"));
  15. System.out.println("Email: " + d.get("email"));
  16. System.out.println("Age: " + d.get("age"));
  17. } }
  18.